Skip to main content

Introduction

caution

This document is for TimeBase Community Edition and TimeBase Enterprise Edition 5.5

QuantQuery Language (QQL) is a query language designed to extract, filter, aggregate and transform data in TimeBase streams.

While QQL is similar to SQL, there are significant differences. QQL is designed to query polymorphic time-series data, while SQL is designed primarily for querying monomorphic fixed-structure data, without any time-series properties.

Getting Started

For demonstration purposes, we suggest using demo streams to guide you through the QQL language. Most of the examples in this tutorial are based on demo streams.

Importing Demo Streams

To get started with QQL:

  1. Download and unzip the following archive file to any folder on your computer.
  1. Launch TimeBase and the TimeBase Web Admin by using the TimeBase Installer, Docker, or other deployment options.

  2. In the bin folder, run TimeBase Shell by double-clicking tickdb.cmd.

  3. In the console prompt, set the database using the following code:

    ==> set db dxtick://localhost:8011
    ==> open
  4. Import demo streams to the TimeBase Server by running the following code:

    open rw
    set src C:\path to a stream file\binance.qsmsg.gz
    set tz GMT
    import binance

    open rw
    set src C:\path to a stream file\orders.qsmsg.gz
    set tz GMT
    import orders

    open rw
    set src C:\path to a stream file\tickquerydemo.qsmsg.gz
    set tz GMT
    import tickquerydemo

    open rw
    set src C:\path to a stream file\packages.qsmsg.gz
    set tz GMT
    import packages

    open rw
    set src C:\path to a stream file\securities.qsmsg.gz
    set tz GMT
    import securities

Now you can run QQL commands in the TimeBase Shell console or the TimeBase Web Admin application.

Additional Resources

To learn how to start TimeBase in a few simple steps, refer to the Quick Start page.

Using TimeBase Shell

After you've started TimeBase Shell, you can type or paste various commands into the console window prompt.

The following sections break down QQL query output.

Header Row

QQL queries return a sequence of stream messages ordered by time.

Every time the type of message changes, you see a heading row, such as:

>deltix.timebase.api.messages.BestBidOfferMessage,TIMESTAMP,SYMBOL,TYPE,offerPrice,offerSize,bidPrice,bidSize

The heading row contains the following elements:

  • In the first cell of the example, you see the greater than sign (>), followed by the class name of the message.
  • Next, you see the standard field headings TIMESTAMP, SYMBOL, and TYPE.
  • The following headings, if any, contain field names declared in the message class.

Subsequent Rows

The lines following the header line contain message data:

  • The first column contains the sequential number of a message (not counting header lines).
  • The rest of the columns contain data values according to the headings in the first row.

Full Query Example

Every query returns messages. Every message in TimeBase contains the following fields, collectively called the entity identity:

  • Class name
  • Timestamp
  • Symbol/type combination
TimeBase Sell Query & Output Example
#query
select price, bidPrice, offerPrice from tickquerydemo

#output
>_,TIMESTAMP,SYMBOL,TYPE,price,bidPrice,offerPrice
0,2011-10-17 17:21:40,GREATCO,EQUITY,_,42.5,43.5
1,2011-10-17 17:21:40,XBANK,EQUITY,_,301.25,301.75
2,2011-10-17 17:21:41,XBANK,EQUITY,301.25,_,_
3,2011-10-17 17:21:42,XBANK,EQUITY,_,298.5,301.5
4,2011-10-17 17:21:43,GREATCO,EQUITY,_,43.0,45.0
5,2011-10-17 17:21:43,XBANK,EQUITY,_,295.0,299.5
6,2011-10-17 17:21:44,GREATCO,EQUITY,44.0,_,_
!end
Additional Resources

Using TimeBase Web Admin

The TimeBase Web Admin application allows viewing streams and stream schemas, creating and editing streams, placing QQL queries, and many other operations.

Additional Resources

For more information on running QQL queries in- the Web Admin application, see TimeBase Web Admin.